import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/circle_user_entity.dart';

CircleUserEntity $CircleUserEntityFromJson(Map<String, dynamic> json) {
  final CircleUserEntity circleUserEntity = CircleUserEntity();
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    circleUserEntity.msg = msg;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    circleUserEntity.code = code;
  }
  final List<CircleUserData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<CircleUserData>(e) as CircleUserData)
      .toList();
  if (data != null) {
    circleUserEntity.data = data;
  }
  return circleUserEntity;
}

Map<String, dynamic> $CircleUserEntityToJson(CircleUserEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['msg'] = entity.msg;
  data['code'] = entity.code;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension CircleUserEntityExtension on CircleUserEntity {
  CircleUserEntity copyWith({
    String? msg,
    int? code,
    List<CircleUserData>? data,
  }) {
    return CircleUserEntity()
      ..msg = msg ?? this.msg
      ..code = code ?? this.code
      ..data = data ?? this.data;
  }
}

CircleUserData $CircleUserDataFromJson(Map<String, dynamic> json) {
  final CircleUserData circleUserData = CircleUserData();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    circleUserData.createTime = createTime;
  }
  final CircleUserDataParams? params = jsonConvert.convert<
      CircleUserDataParams>(json['params']);
  if (params != null) {
    circleUserData.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    circleUserData.id = id;
  }
  final int? deviceId = jsonConvert.convert<int>(json['deviceId']);
  if (deviceId != null) {
    circleUserData.deviceId = deviceId;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    circleUserData.userId = userId;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    circleUserData.status = status;
  }
  final int? operId = jsonConvert.convert<int>(json['operId']);
  if (operId != null) {
    circleUserData.operId = operId;
  }
  final String? terminalId = jsonConvert.convert<String>(json['terminalId']);
  if (terminalId != null) {
    circleUserData.terminalId = terminalId;
  }
  final String? deviceName = jsonConvert.convert<String>(json['deviceName']);
  if (deviceName != null) {
    circleUserData.deviceName = deviceName;
  }
  final int? deviceRelationId = jsonConvert.convert<int>(
      json['deviceRelationId']);
  if (deviceRelationId != null) {
    circleUserData.deviceRelationId = deviceRelationId;
  }
  final int? devicePermission = jsonConvert.convert<int>(
      json['devicePermission']);
  if (devicePermission != null) {
    circleUserData.devicePermission = devicePermission;
  }
  final CircleUserDataSysUser? sysUser = jsonConvert.convert<
      CircleUserDataSysUser>(json['sysUser']);
  if (sysUser != null) {
    circleUserData.sysUser = sysUser;
  }
  final int? inviteId = jsonConvert.convert<int>(json['inviteId']);
  if (inviteId != null) {
    circleUserData.inviteId = inviteId;
  }
  return circleUserData;
}

Map<String, dynamic> $CircleUserDataToJson(CircleUserData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['deviceId'] = entity.deviceId;
  data['userId'] = entity.userId;
  data['status'] = entity.status;
  data['operId'] = entity.operId;
  data['terminalId'] = entity.terminalId;
  data['deviceName'] = entity.deviceName;
  data['deviceRelationId'] = entity.deviceRelationId;
  data['devicePermission'] = entity.devicePermission;
  data['sysUser'] = entity.sysUser?.toJson();
  data['inviteId'] = entity.inviteId;
  return data;
}

extension CircleUserDataExtension on CircleUserData {
  CircleUserData copyWith({
    String? createTime,
    CircleUserDataParams? params,
    int? id,
    int? deviceId,
    int? userId,
    int? status,
    int? operId,
    String? terminalId,
    String? deviceName,
    int? deviceRelationId,
    int? devicePermission,
    CircleUserDataSysUser? sysUser,
    int? inviteId,
  }) {
    return CircleUserData()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..deviceId = deviceId ?? this.deviceId
      ..userId = userId ?? this.userId
      ..status = status ?? this.status
      ..operId = operId ?? this.operId
      ..terminalId = terminalId ?? this.terminalId
      ..deviceName = deviceName ?? this.deviceName
      ..deviceRelationId = deviceRelationId ?? this.deviceRelationId
      ..devicePermission = devicePermission ?? this.devicePermission
      ..sysUser = sysUser ?? this.sysUser
      ..inviteId = inviteId ?? this.inviteId;
  }
}

CircleUserDataParams $CircleUserDataParamsFromJson(Map<String, dynamic> json) {
  final CircleUserDataParams circleUserDataParams = CircleUserDataParams();
  return circleUserDataParams;
}

Map<String, dynamic> $CircleUserDataParamsToJson(CircleUserDataParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension CircleUserDataParamsExtension on CircleUserDataParams {
}

CircleUserDataSysUser $CircleUserDataSysUserFromJson(
    Map<String, dynamic> json) {
  final CircleUserDataSysUser circleUserDataSysUser = CircleUserDataSysUser();
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    circleUserDataSysUser.createBy = createBy;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    circleUserDataSysUser.createTime = createTime;
  }
  final CircleUserDataSysUserParams? params = jsonConvert.convert<
      CircleUserDataSysUserParams>(json['params']);
  if (params != null) {
    circleUserDataSysUser.params = params;
  }
  final String? userType = jsonConvert.convert<String>(json['userType']);
  if (userType != null) {
    circleUserDataSysUser.userType = userType;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    circleUserDataSysUser.userId = userId;
  }
  final String? userName = jsonConvert.convert<String>(json['userName']);
  if (userName != null) {
    circleUserDataSysUser.userName = userName;
  }
  final String? nickName = jsonConvert.convert<String>(json['nickName']);
  if (nickName != null) {
    circleUserDataSysUser.nickName = nickName;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    circleUserDataSysUser.email = email;
  }
  final String? phonenumber = jsonConvert.convert<String>(json['phonenumber']);
  if (phonenumber != null) {
    circleUserDataSysUser.phonenumber = phonenumber;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    circleUserDataSysUser.sex = sex;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    circleUserDataSysUser.avatar = avatar;
  }
  final String? password = jsonConvert.convert<String>(json['password']);
  if (password != null) {
    circleUserDataSysUser.password = password;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    circleUserDataSysUser.status = status;
  }
  final String? delFlag = jsonConvert.convert<String>(json['delFlag']);
  if (delFlag != null) {
    circleUserDataSysUser.delFlag = delFlag;
  }
  final String? loginIp = jsonConvert.convert<String>(json['loginIp']);
  if (loginIp != null) {
    circleUserDataSysUser.loginIp = loginIp;
  }
  final List<CircleUserDataSysUserRoles>? roles = (json['roles'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<CircleUserDataSysUserRoles>(
          e) as CircleUserDataSysUserRoles).toList();
  if (roles != null) {
    circleUserDataSysUser.roles = roles;
  }
  final bool? admin = jsonConvert.convert<bool>(json['admin']);
  if (admin != null) {
    circleUserDataSysUser.admin = admin;
  }
  return circleUserDataSysUser;
}

Map<String, dynamic> $CircleUserDataSysUserToJson(
    CircleUserDataSysUser entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createBy'] = entity.createBy;
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['userType'] = entity.userType;
  data['userId'] = entity.userId;
  data['userName'] = entity.userName;
  data['nickName'] = entity.nickName;
  data['email'] = entity.email;
  data['phonenumber'] = entity.phonenumber;
  data['sex'] = entity.sex;
  data['avatar'] = entity.avatar;
  data['password'] = entity.password;
  data['status'] = entity.status;
  data['delFlag'] = entity.delFlag;
  data['loginIp'] = entity.loginIp;
  data['roles'] = entity.roles?.map((v) => v.toJson()).toList();
  data['admin'] = entity.admin;
  return data;
}

extension CircleUserDataSysUserExtension on CircleUserDataSysUser {
  CircleUserDataSysUser copyWith({
    String? createBy,
    String? createTime,
    CircleUserDataSysUserParams? params,
    String? userType,
    int? userId,
    String? userName,
    String? nickName,
    String? email,
    String? phonenumber,
    String? sex,
    String? avatar,
    String? password,
    String? status,
    String? delFlag,
    String? loginIp,
    List<CircleUserDataSysUserRoles>? roles,
    bool? admin,
  }) {
    return CircleUserDataSysUser()
      ..createBy = createBy ?? this.createBy
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..userType = userType ?? this.userType
      ..userId = userId ?? this.userId
      ..userName = userName ?? this.userName
      ..nickName = nickName ?? this.nickName
      ..email = email ?? this.email
      ..phonenumber = phonenumber ?? this.phonenumber
      ..sex = sex ?? this.sex
      ..avatar = avatar ?? this.avatar
      ..password = password ?? this.password
      ..status = status ?? this.status
      ..delFlag = delFlag ?? this.delFlag
      ..loginIp = loginIp ?? this.loginIp
      ..roles = roles ?? this.roles
      ..admin = admin ?? this.admin;
  }
}

CircleUserDataSysUserParams $CircleUserDataSysUserParamsFromJson(
    Map<String, dynamic> json) {
  final CircleUserDataSysUserParams circleUserDataSysUserParams = CircleUserDataSysUserParams();
  return circleUserDataSysUserParams;
}

Map<String, dynamic> $CircleUserDataSysUserParamsToJson(
    CircleUserDataSysUserParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension CircleUserDataSysUserParamsExtension on CircleUserDataSysUserParams {
}

CircleUserDataSysUserRoles $CircleUserDataSysUserRolesFromJson(
    Map<String, dynamic> json) {
  final CircleUserDataSysUserRoles circleUserDataSysUserRoles = CircleUserDataSysUserRoles();
  final CircleUserDataSysUserRolesParams? params = jsonConvert.convert<
      CircleUserDataSysUserRolesParams>(json['params']);
  if (params != null) {
    circleUserDataSysUserRoles.params = params;
  }
  final int? roleId = jsonConvert.convert<int>(json['roleId']);
  if (roleId != null) {
    circleUserDataSysUserRoles.roleId = roleId;
  }
  final String? roleName = jsonConvert.convert<String>(json['roleName']);
  if (roleName != null) {
    circleUserDataSysUserRoles.roleName = roleName;
  }
  final String? roleKey = jsonConvert.convert<String>(json['roleKey']);
  if (roleKey != null) {
    circleUserDataSysUserRoles.roleKey = roleKey;
  }
  final String? roleSort = jsonConvert.convert<String>(json['roleSort']);
  if (roleSort != null) {
    circleUserDataSysUserRoles.roleSort = roleSort;
  }
  final String? dataScope = jsonConvert.convert<String>(json['dataScope']);
  if (dataScope != null) {
    circleUserDataSysUserRoles.dataScope = dataScope;
  }
  final bool? menuCheckStrictly = jsonConvert.convert<bool>(
      json['menuCheckStrictly']);
  if (menuCheckStrictly != null) {
    circleUserDataSysUserRoles.menuCheckStrictly = menuCheckStrictly;
  }
  final bool? deptCheckStrictly = jsonConvert.convert<bool>(
      json['deptCheckStrictly']);
  if (deptCheckStrictly != null) {
    circleUserDataSysUserRoles.deptCheckStrictly = deptCheckStrictly;
  }
  final String? status = jsonConvert.convert<String>(json['status']);
  if (status != null) {
    circleUserDataSysUserRoles.status = status;
  }
  final bool? flag = jsonConvert.convert<bool>(json['flag']);
  if (flag != null) {
    circleUserDataSysUserRoles.flag = flag;
  }
  final bool? admin = jsonConvert.convert<bool>(json['admin']);
  if (admin != null) {
    circleUserDataSysUserRoles.admin = admin;
  }
  return circleUserDataSysUserRoles;
}

Map<String, dynamic> $CircleUserDataSysUserRolesToJson(
    CircleUserDataSysUserRoles entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['params'] = entity.params?.toJson();
  data['roleId'] = entity.roleId;
  data['roleName'] = entity.roleName;
  data['roleKey'] = entity.roleKey;
  data['roleSort'] = entity.roleSort;
  data['dataScope'] = entity.dataScope;
  data['menuCheckStrictly'] = entity.menuCheckStrictly;
  data['deptCheckStrictly'] = entity.deptCheckStrictly;
  data['status'] = entity.status;
  data['flag'] = entity.flag;
  data['admin'] = entity.admin;
  return data;
}

extension CircleUserDataSysUserRolesExtension on CircleUserDataSysUserRoles {
  CircleUserDataSysUserRoles copyWith({
    CircleUserDataSysUserRolesParams? params,
    int? roleId,
    String? roleName,
    String? roleKey,
    String? roleSort,
    String? dataScope,
    bool? menuCheckStrictly,
    bool? deptCheckStrictly,
    String? status,
    bool? flag,
    bool? admin,
  }) {
    return CircleUserDataSysUserRoles()
      ..params = params ?? this.params
      ..roleId = roleId ?? this.roleId
      ..roleName = roleName ?? this.roleName
      ..roleKey = roleKey ?? this.roleKey
      ..roleSort = roleSort ?? this.roleSort
      ..dataScope = dataScope ?? this.dataScope
      ..menuCheckStrictly = menuCheckStrictly ?? this.menuCheckStrictly
      ..deptCheckStrictly = deptCheckStrictly ?? this.deptCheckStrictly
      ..status = status ?? this.status
      ..flag = flag ?? this.flag
      ..admin = admin ?? this.admin;
  }
}

CircleUserDataSysUserRolesParams $CircleUserDataSysUserRolesParamsFromJson(
    Map<String, dynamic> json) {
  final CircleUserDataSysUserRolesParams circleUserDataSysUserRolesParams = CircleUserDataSysUserRolesParams();
  return circleUserDataSysUserRolesParams;
}

Map<String, dynamic> $CircleUserDataSysUserRolesParamsToJson(
    CircleUserDataSysUserRolesParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension CircleUserDataSysUserRolesParamsExtension on CircleUserDataSysUserRolesParams {
}